<?php
class LoginSubsectionData_Data {
	
	private $db;
	
	public function __construct(){
		$this->db = new MysqlImproved_Driver();
	}
	
	
		
		public function getPageData($section){
			$this->db->connect();
			$section = $this->db->escape($section);
			$this->db->prepare(
				"
				SELECT
				category_settings.category_sitename,
				category_settings.category_siteurl,
				category_settings.category_templatename,
				category_settings.category_access_level,
				meta_category.category_meta_keywords,
				meta_category.category_meta_description,
				meta_category.category_meta_title,
				meta_category.category_link_title,
				meta_category.category_link_alt,
				content_category.category_title,
				content_category.category_description,
				content_category.category_content
				FROM
				category_settings,
				meta_category,
				content_category
				WHERE
				category_settings.category_sitename = '$section'
				AND
				category_settings.category_sitename = meta_category.category_sitename
				AND
				category_settings.category_sitename = content_category.category_sitename
				AND
				content_category.category_sitename = '$section'
				AND
				meta_category.category_sitename = '$section'
				LIMIT
				1
				;
				"
			);
			$this->db->query();
			$article = $this->db->fetch('array');
			return $article;
		}
		
		public function isOnline($section){
			$this->db->connect();
			$section = $this->db->escape($section);
			$this->db->prepare(
					"
				SELECT
				meta_category.category_sitename,
				category_settings.category_siteonline
				FROM
				category_settings
				INNER JOIN meta_category ON category_settings.category_sitename =meta_category.category_sitename
				WHERE
				category_settings.category_sitename = '$section'
				AND
				category_settings.category_siteonline = '1'
				;
				"
			);
			return $this->db->query();
		
		}
}